<?php
  $query = "SELECT title,link,parentid,level FROM menu where menutypeid = 3 and isactive = 1 and isdeleted = 0 and parentid=0";
  $result = mysql_query($query);
  $menusayisi = mysql_num_rows($result);
?>

<?php
    echo "<SCRIPT type=\"text/javascript\" src=\"../js/load.js\"></SCRIPT>";
    echo "<SCRIPT type=\"text/javascript\" charset=\"utf-8\" src=\"../js/redvase.js\"></SCRIPT>
    <SCRIPT type=\"text/javascript\">
    function showsubmenu(id){
            submenu=document.getElementById('s'+id);
            for(i=1;i<=". $menusayisi .";i++){
                    if(i==id){
                            submenu.style.display=\"block\";
                    } else{
                            document.getElementById('s'+i).style.display=\"none\";
                    }
            }
    }
    </SCRIPT>";
?>

<div id="navigation">
    <ul id="mymenu">
    <?php
    while($field=mysql_fetch_array($result)){
        echo "<li><a onmouseover=\"javascript:showsubmenu(" . $field[level] .")\"  href=\"". $field[link] ."\">". $field[title] ."</a></li>";
    }
    ?>
    </ul>
</div>

<div id="sublinks" style="line-height:20px;">
  <?php
  for ($i = 1; $i <= $menusayisi; $i++) {
    echo "<ul id=\"s".$i."\">";
    $query1 = "SELECT title,link,parentid,level FROM menu where menutypeid = 3 and isactive = 1 and isdeleted = 0 and parentid != 0";
    $result1 = mysql_query($query1);
          while($field1=mysql_fetch_array($result1)){
                if ($i == $field1[parentid]){
                    echo"<li><a href=".$field1[link].">".$field1[title]."</a></li>";
                }
          }
          echo "</ul>";
  }
  ?>
</div>


